/*
 * Create Author  : jinpeng.chen
 * Create Date    : 2018-10-17
 * Project        : designpattern-learn
 * File Name      : TestResponsibilityChain.java
 *
 * Copyright (c) 2010-2018 by 18Birdies, LLC.
 * All Rights Reserved.
 *
 */
package com.charles.designpattern.responsibilitychain;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 功能描述:  <p>
 *
 * @author : jinpeng.chen <p>
 * @version 1.0 2018-10-17
 * @since designpattern-learn 1.0
 */
@Controller
public class TestResponsibilityChain {

  @Autowired
  private HtmlFilter htmlFilter;
  @Autowired
  private FaceFilter faceFilter;
  @Autowired
  private SensitiveFilter sensitiveFilter;

  @RequestMapping("/testResponsibilityChain")
  @ResponseBody
  public String testStrategy() {
    BizRequest bizRequest = new BizRequest(":),<script>,敏感,被就业,网络授课");
    BizResponse bizResponse = new BizResponse();
    FilterChain<BizRequest, BizResponse> filterChain = new FilterChain<>();
    filterChain.addFilter(htmlFilter)
        .addFilter(faceFilter)
        .addFilter(sensitiveFilter)
        .doFilter(bizRequest, bizResponse, filterChain);
    return bizResponse.getRequestStr();
  }
}
